package com.ruoyi.training.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.training.domain.TrainPlanPaperQuestion;
import com.ruoyi.training.mapper.TrainPlanPaperQuestionMapper;
import com.ruoyi.training.service.ITrainPlanPaperQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 培训计划试卷题目Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class TrainPlanPaperQuestionServiceImpl implements ITrainPlanPaperQuestionService {
    @Resource
    private TrainPlanPaperQuestionMapper trainPlanPaperQuestionMapper;

    /**
     * 查询培训计划试卷题目
     *
     * @param id 培训计划试卷题目主键
     * @return 培训计划试卷题目
     */
    @Override
    public TrainPlanPaperQuestion selectTrainPlanPaperQuestionById(Long id) {
        return trainPlanPaperQuestionMapper.selectTrainPlanPaperQuestionById(id);
    }

    /**
     * 查询培训计划试卷题目列表
     *
     * @param trainPlanPaperQuestion 培训计划试卷题目
     * @return 培训计划试卷题目
     */
    @Override
    public List<TrainPlanPaperQuestion> selectTrainPlanPaperQuestionList(TrainPlanPaperQuestion trainPlanPaperQuestion) {
        return trainPlanPaperQuestionMapper.selectTrainPlanPaperQuestionList(trainPlanPaperQuestion);
    }

    /**
     * 新增培训计划试卷题目
     *
     * @param trainPlanPaperQuestion 培训计划试卷题目
     * @return 结果
     */
    @Override
    public int insertTrainPlanPaperQuestion(TrainPlanPaperQuestion trainPlanPaperQuestion) {
        trainPlanPaperQuestion.setCreateTime(DateUtils.getNowDate());
        return trainPlanPaperQuestionMapper.insertTrainPlanPaperQuestion(trainPlanPaperQuestion);
    }

    /**
     * 修改培训计划试卷题目
     *
     * @param trainPlanPaperQuestion 培训计划试卷题目
     * @return 结果
     */
    @Override
    public int updateTrainPlanPaperQuestion(TrainPlanPaperQuestion trainPlanPaperQuestion) {
        trainPlanPaperQuestion.setUpdateTime(DateUtils.getNowDate());
        return trainPlanPaperQuestionMapper.updateTrainPlanPaperQuestion(trainPlanPaperQuestion);
    }

    /**
     * 批量删除培训计划试卷题目
     *
     * @param ids 需要删除的培训计划试卷题目主键
     * @return 结果
     */
    @Override
    public int deleteTrainPlanPaperQuestionByIds(Long[] ids) {
        return trainPlanPaperQuestionMapper.deleteTrainPlanPaperQuestionByIds(ids);
    }

    /**
     * 删除培训计划试卷题目信息
     *
     * @param id 培训计划试卷题目主键
     * @return 结果
     */
    @Override
    public int deleteTrainPlanPaperQuestionById(Long id) {
        return trainPlanPaperQuestionMapper.deleteTrainPlanPaperQuestionById(id);
    }
}
